package demo3;

import java.util.Scanner;

public class Practise3 {
    public static void main(String[] args) {
        int money = 0;
        Scanner in = new Scanner(System.in);
        int count = in.nextInt();
        int day1 = 0;
        int day2 = 0;
        int ret = 0;
        for (int i = 0; i < count; i++) {
            day2 = in.nextInt();
            money = day2 - day1 + money < 50 ? day2 - day1 + money : 50;
            ret += money / 8;
            money %= 8;
            day1 = day2;
        }
        System.out.println(ret);
    }
}
